import instance from "../../url/chat.js";

const get_user_room_request =async  (user_id,limit=1) => { 
    return await instance.get(`/ws/get/room/request?user_id=${user_id}&limit=${limit}`)
        .then((response) => {
            if (response != 0) { 
                return response
            }
        })
}
const response_to_request = async(user_id,deal,ids) =>{ 
    return await instance.post(`/ws/set/room/response_to_request`,
        {
            deal: deal,
            user_id: user_id,
            ids:ids
        }
    )
        .then((response) => {
        console.log(response)
        if (response != 0) { 
            return response
        }
    })
}
const get_message_no_response = async (user_id, limit=1) => {
    return await instance.get(`/ws/get/about/message/noresponse?user_id=${user_id}&limit=${limit}`)
        .then((response) => {
            if (response != 0) { 
                return response
            }
        })
        
      
}
const del_message_no_response = async (user_id, message_id) => { 
    return await instance.post(`/ws/delete/about/message/noresponse?user_id=${user_id}&message_id=${message_id}`)
        .then((response) => {
            if (response != 0) {
                return response
            } else { 
                return 0
            }
        })
}


export { 
        get_user_room_request,response_to_request,get_message_no_response,del_message_no_response
}



